Skip to main content

All Questions

1vote
1answer
131views

How to enable validation on MVC form?

I am building a website with MVC and I have a view with a form. I want validation to appear when users leave a field blank, however I can not get this to work. I have tried adding the Data annotation ...
Ryan Tobin's user avatar
0votes
1answer
199views

Undesired validation error message produced from a form bound to string property: The value '' is invalid

If a user submits an empty value, I would like the following validation error to be displayed: "The Comment field is required." However, the actual validation error produced is: "The ...
Matteo Catrini's user avatar
2votes
1answer
73views

why my validation is not working? asp.net mvc

I tried to put a ValidationMessageFor in my view to control data but it's not working and data goes to my post action. Here is my model class: public enum CustomerType { JuridicalPerson, ...
Alireza Ahmadi's user avatar
1vote
1answer
136views

@Html.ValidationMessageFor not preventing user from to skip Required fields

I have the following code. I have added necessary script files for validating the fields too but the validation does not seem to work. The Required fields can be skipped even if the user has not given ...
TheNoob's user avatar
0votes
1answer
2kviews

Custom validation for List<string> data annotation keeps showing other input that is not empty

I am trying to create a required custom validation for List Data Annotation but when one of the input field is empty, the rest of the input that is bind to the data annotation also shows the error ...
Identifier1210's user avatar
0votes
3answers
57views

Checking Sucsessfull Validation of Form

I have a C# ViewModel, specifying data annotations for automatic validation. I render the View in Razor code. I need to check in javascript, client side, if the ALL validations went through, or not. ...
Stefan's user avatar
0votes
1answer
146views

MVC view not being generated with validation from the database

I'm using MVC 5 with EF6 and Database first.. I have two tables, table A and B, both of them with non nullable fields. I did the same procedure for both of them, create the controller and the view, ...
jcsmata's user avatar
0votes
1answer
2kviews

Required field validator for a textbox in MVC depend on a dynamically generated drop down list

I'm generating some controls with the help of a for-each loop. I would like to validate the textbox depend on the answer of the dropdown. For some questions, validator should be enabled if the ...
kas_miyulu's user avatar
0votes
2answers
1kviews

Range validation in MVC Just shows Default Message

I'm totally confused about this ridiculous problem but I have to solve. I have a field and I set required and range validation on it: [Required(ErrorMessage = ValidationMessage.InputDataStart + Field....
Mehdi FarokhTabar's user avatar
0votes
0answers
146views

MVC C# Validate information against database

We have a form that you can put in manually. This form ties into a customer. I was tasked to write a validator that checks to see if a unique identifier is changed, that is checks the database, ...
BlowFish's user avatar
0votes
2answers
318views

database.SaveChanges() throws EntityValidationException

New to MVC. When I try to add a user to the database using Entity Framework Database First I get this exception: An exception of type 'System.Data.Entity.Validation.DbEntityValidationException' ...
bankey's user avatar
1vote
2answers
2kviews

Remote validation shows error message but still lets the form submit and saves in database MVC 5

The situation is, combination of Student Reg. No. and Select Course is always unique. Upon selection of a combination which was saved before in database, the expected results are, First Expected ...
Tareq's user avatar
0votes
0answers
548views

View not reflecting model's custom validation errors (using Ajax.BeginForm)

Newbie here. But have done some reading and searching before posting. Been scratching my head around this for last few days. Note that I am attempting validation using MVC (not Javascript) I have ...
ShaQ.Blogs's user avatar
0votes
0answers
2kviews

MVC Ajax BeginForm validation

I have a Bootstrap modal that makes an insert. I am using Ajax BeginForm and I have problem with the validation. Normal validation like: required fields works great. My problem is that I have a server ...
MarcosF8's user avatar
0votes
1answer
756views

jQuery valid return true when the form is NOT valid

I have an MVC razor view with the validation rules for the properties defined in my model. Since i want to return a partialView to my page i did a "custom" submit function to be called : function ...
user1287678's user avatar

153050per page
close